#include<iostream>
#include<cstdio>
using namespace std;

int main(){
	int a,b,c,d,e;
	cin >> a >> b >> c >> d >> e;
	//1.
	a /= 3;
	b += a;
	e += a;
	//2
	b /= 3;
	a += b;
	c += b;
	//3
	c /= 3;
	b += c;
	d += c;
	//4
	d /= 3;
	c += d;
	e += d;
	//5 
	e /= 3;
	a += e;
	d += e;
	printf("%5d%5d%5d%5d%5d",a,b,c,d,e);
	return 0;
}
